<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_personal.*" %>
<%@page import="com.lmpop.trade.ti_address.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<jsp:useBean id="bean" class="com.lmpop.frame.util.RandomID" scope="page" />



  <% 
	String cust_id = "";	
	if( session.getAttribute("session_cust_id") != null ){
		cust_id = session.getAttribute("session_cust_id").toString();
	}
  	String a_addr_id = bean.GenTradeId();
	
	Map ti_address = new Hashtable();
	Ti_addressInfo ti_addressInfo = new Ti_addressInfo();
	String iStart = "0";
	int limit = 20;
	ti_address.put("user_id",_user_id);
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	int counter = ti_addressInfo.getCountByObj(ti_address);

  %>
	
<script language="javascript" type="text/javascript" src="commen.js"></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_areaInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script language="javascript" type="text/javascript" src="js_customer.js"></script>
	
<div class="f-right">
    <table width="100%" cellpadding="0" cellspacing="0" class="table_main" >
      <tr>
        <th width="5%" height="40" align="center"><img src="/program/member/index/images/icon1.gif" /></th>
        <th width="75%"><h3>新增收货地址</h3></th>

      </tr>
    </table>

    <!--Content部分开始-->
    <DIV class="focus-area-setTab">
      <DIV class="focus-area-setTab-menu">
        <DIV class="clear"></DIV>
      </DIV>
      <DIV class="focus-area-setTab-content">
        <DIV id=con_one_1 >
          <table width="100%" cellspacing="0"  cellpadding="0" >
            <tr bgcolor="#fcf8fb">
              <td height="100" valign="top">
		  	<form action="/doTradeReg.do" name="addForm" method="post">
			    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablelist0">
			    <tr>
                    <td  height="38" class="art_col" width="10%">收货人姓名<font color="red">*</font></td>
                    <td width="40%"><input name="consignee" id="consignee" value="" type="text" maxlength="50" onkeyup= "value=value.replace(/[^\w\u4E00-\u9FA5]/g,'');"  onbeforepaste= "clearSBC();" >
					</td>
                </tr>
			    <tr>
                    <td  height="38" class="art_col">所在地区<font color="red">*</font></td>
                    <td>
			<!--
					<font >您当前的地区：<span id="areaoutput"></span></font><br/>
			-->		
					<select name="province" id="province" onclick="setCitys(this.value)">
					  <option value="">省份</option> 
					</select>
					<select name="eparchy_code" id="eparchy_code" onclick="setAreas(this.value)">
					  <option value="">地级市</option> 
					 </select>
					<select name="city_code" id="city_code" style="display:inline" >
					 <option value="">市、县级市、县</option> 
					</select>
					<input type="hidden" name="area_attr_bak" id="area_attr_bak" value="" />
					<input type="hidden" name="area_attr" id="area_attr" value="" />
					</td>
                </tr>
			    <tr>
                    <td  height="38" class="art_col">街道地址<font color="red">*</font></td>
                    <td>
					<textarea name="address" id="address" style="width:400px;height:50px" onkeyup= "value=value.replace(/[^\w\u4E00-\u9FA5]/g,'');"  onbeforepaste= "clearSBC();"></textarea>
					</td>
                </tr>
			
			    <tr>
                    <td  height="38" class="art_col">邮政编码:</td>
                    <td><input name="post_code" id="post_code" value="" type="text" maxlength="6" onkeyup="clearNoNum(this);">
					</td>
                </tr>
			    <tr>
                    <td  height="38" class="art_col">手机号<font color="red">*</font></td>
                    <td><input name="cellphone" id="cellphone" value="" type="text" maxlength="15" onkeyup="clearNoNum(this);"><font color="red">(手机号和电话号码请至少填写一项！)</font>
					</td>
                </tr>	                
			    <tr>
                    <td  height="38" class="art_col">电话号码:</td>
                    <td><input name="tel" id="tel" value="" type="text" maxlength="20" onkeyup="clearNoNum(this);">
					</td>
                </tr>	

			    <tr>
                    <td  height="38" class="art_col">最佳送货时间:</td>
                    <td>
						<select name="best_time">
							<option value="0">工作日、双休日与假日均可送货</option>
							<option value="1">只有双休日、假日送货（工作日不用送货)</option>
							<option value="2">只有工作日送货（双休日、假日不用送）</option>
						</select>
					</td>
                </tr>	                
				
			    <tr>
                    <td  height="38" class="art_col">排序:</td>
                    <td><input name="level_no" id="infolevel" style="width:50px" value="1" type="text" maxlength="3" size="3" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" >
					</td>
                </tr>	
				 <tr>
              <td height="50" align="center">
			  <%
				if(counter < 5){
			  %>
			  <input type="button" name="Submit1" value="确定" class="button2" onclick="submitAddrs()">
			  <%
				} else {
			  %>
			  地址已满!
			  <%
				}
			  %>
			  <input type="button" name="Submit2" value="返回" class="button2" onclick="window.location.href='index.jsp?menu_id=<%=menu_id%>';">
              </td>
            </tr>
				<input type="hidden" name="bpm_id" id="bpm_id"  value="1615" />
	  			<input type="hidden" name="addr_id" id="addr_id"  value="<%=a_addr_id %>" />
				<input type="hidden" name="user_id" id ="user_id" value="<%=_user_id %>" />
				<input type="hidden" name="cust_id" id ="cust_id" value="<%=cust_id %>" />
				
          </table>
				</form>
				</td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" >
           
          </table>
        </DIV>
      
      </DIV>
    </DIV>
  </div>
</div>